﻿// cpptest.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include "pch.h"
#include <iostream>
#include <string>
#include <Windows.h>
#include <CommCtrl.h>
#include "Window.h"
#include "WindowManager.h"

void test() {
    std::wstring clsName = L"CabinetWClass";
    std::wstring text = L"文件资源管理器";
    TCHAR itemText[512] = {0};

    Window top = WindowManager::FindTopWindow(clsName, true, text, true);

    int id = 0x064;
    Window tv = top.findChild(id, L"SysTreeView32", true);

    HTREEITEM hItem = TreeView_GetChild(tv.getHWnd(), TVI_ROOT);

    TV_ITEM item = {0};
    item.mask = TVIF_TEXT;
    item.hItem = hItem;
    item.pszText = itemText;
    item.cchTextMax = sizeof(itemText)/sizeof(itemText[0]);
    item.stateMask = TVIS_EXPANDED;
    
    BOOL ret = TreeView_GetItem(tv.getHWnd(), &item);
    ret = TreeView_GetCount(tv.getHWnd());
}

int main() {
    test();
}
